<?php $count = count($children); ?>

<div class="children">

    <div class="link">
        <div class="link-between"></div>
    </div>

    <?php foreach($children as $key => $person): ?>

    <?php
    // decal
    $decal = ($person->relation()) ? 'decal' : null;

    // class
    if($count == 1)
        $class = 'only';
    elseif($key == 0)
        $class = 'first';
    elseif($key == $count - 1)
        $class = 'last';
    else
        $class = null;
    ?>

    <div class="child <?=$class?>">
            <div class="link">
            <div class="link-children <?=$class?> <?=$decal?>"></div>
        </div>
        <?php app\libs\Tree::display($person); ?>
    </div>

    <?php endforeach; ?>

</div>